package Lesson19Homework;
import java.util.Scanner;
public class ElectronicSecuredNotepad extends SecuredNotepad implements IElectronicDevice, ISecuredNotepad
{

	private String password;
	boolean isStarted = true;
	
	ElectronicSecuredNotepad(int numberOfPages, String password) 
	{
		super(numberOfPages, password);
	}
	@Override
	public void viewPages() {
		if(isStarted)
			super.viewPages();
	}
	@Override
	public void deleteText(Page selectedPage) {
		if(isStarted)
			super.deleteText(selectedPage);
	}
	@Override
	public void replaceTextInPage(int pageNumber, String newText) {
		if(isStarted)
			super.replaceTextInPage(pageNumber, newText);
	}
	@Override
	public void addText(int pageNumber, String newText) {
		if(isStarted)
			super.addText(pageNumber, newText);
	}
	@Override
	public boolean askForPassword()
	{
		Scanner sc = new Scanner(System.in);
		return sc.next().equals(password);
	}

	@Override
	public void sart() {
	
		if(isStarted)
			System.out.println("The notepad is started!");
	}

	@Override
	public void stop() {
		if(!isStarted)
			System.out.println("The notepad is stopped!");
		
	}

	@Override
	public boolean isStarted() 
	{
		return isStarted;
	}

}

